
import Vue from 'vue'

// you can set only in production env show the error-log
// if (process.env.NODE_ENV === 'production') {

Vue.config.errorHandler = function (err, vm, info, a) {
  // Don't ask me why I use Vue.nextTick, it just a hack.
  // detail see https://forum.vuejs.org/t/dispatch-in-vue-config-errorhandler-has-some-problem/23500
  let image = new Image()
  let prefix = ''
  if (process.env.NODE_ENV === 'production') {
    prefix = '/api/'
  } else {
    prefix = '/'
  }
  image.src = `${prefix}errorLog?url=${window.location.href}&info=${info}&err=${err}&platform=h5`
}
